package com.zhonghui.scm.service.impl;

import java.util.Date;
import java.util.List;
import com.zhonghui.common.utils.DateUtils;
import com.zhonghui.common.utils.SecurityUtils;
import com.zhonghui.scm.domain.ScmSaleSupplierBill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhonghui.scm.mapper.ScmSaleSupplierMapper;
import com.zhonghui.scm.domain.ScmSaleSupplier;
import com.zhonghui.scm.service.IScmSaleSupplierService;

/**
 * 供应链SCM-销售管理-供应商Service业务层处理
 *
 * @author zhonghui
 * @date 2022-05-21
 */
@Service
public class ScmSaleSupplierServiceImpl implements IScmSaleSupplierService
{
    @Autowired
    private ScmSaleSupplierMapper scmSaleSupplierMapper;

    /**
     * 查询供应链SCM-销售管理-供应商
     *
     * @param id 供应链SCM-销售管理-供应商主键
     * @return 供应链SCM-销售管理-供应商
     */
    @Override
    public ScmSaleSupplier selectScmSaleSupplierById(Long id)
    {
        return scmSaleSupplierMapper.selectScmSaleSupplierById(id);
    }

    /**
     * 查询供应链SCM-销售管理-供应商列表
     *
     * @param scmSaleSupplier 供应链SCM-销售管理-供应商
     * @return 供应链SCM-销售管理-供应商
     */
    @Override
    public List<ScmSaleSupplier> selectScmSaleSupplierList(ScmSaleSupplier scmSaleSupplier)
    {
        return scmSaleSupplierMapper.selectScmSaleSupplierList(scmSaleSupplier);
    }

    /**
     * 新增供应链SCM-销售管理-供应商
     *
     * @param scmSaleSupplier 供应链SCM-销售管理-供应商
     * @return 结果
     */
    @Override
    public int insertScmSaleSupplier(ScmSaleSupplier scmSaleSupplier)
    {
        scmSaleSupplier.setApplicantId(SecurityUtils.getUserId());
        scmSaleSupplier.setApplicantDate(DateUtils.getNowDate());
        return scmSaleSupplierMapper.insertScmSaleSupplier(scmSaleSupplier);
    }

    /**
     * 修改供应链SCM-销售管理-供应商
     *
     * @param scmSaleSupplier 供应链SCM-销售管理-供应商
     * @return 结果
     */
    @Override
    public int updateScmSaleSupplier(ScmSaleSupplier scmSaleSupplier)
    {
        return scmSaleSupplierMapper.updateScmSaleSupplier(scmSaleSupplier);
    }

    /**
     * 批量删除供应链SCM-销售管理-供应商
     *
     * @param ids 需要删除的供应链SCM-销售管理-供应商主键
     * @return 结果
     */
    @Override
    public int deleteScmSaleSupplierByIds(Long[] ids)
    {
        return scmSaleSupplierMapper.deleteScmSaleSupplierByIds(ids);
    }

    /**
     * 删除供应链SCM-销售管理-供应商信息
     *
     * @param id 供应链SCM-销售管理-供应商主键
     * @return 结果
     */
    @Override
    public int deleteScmSaleSupplierById(Long id)
    {
        return scmSaleSupplierMapper.deleteScmSaleSupplierById(id);
    }
}
